package com.asset.dispoal.menu.service.commom;

import com.asset.dispoal.menu.domain.db.entity.GbMenuDo;
import com.asset.dispoal.menu.domain.db.mapper.GbMenuMapper;
import com.asset.dispoal.menu.dto.requset.GbMenuRequest;
import com.asset.dispoal.menu.service.converter.MenuConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/2/28$
 */
@Component
public class UpdateMenuCommand implements BaseCommand<GbMenuRequest, Result> {

    @Autowired
    GbMenuMapper gbMenuMapper;

    @Override
    public Result execute(GbMenuRequest request) {
        GbMenuDo gbMenuDo = MenuConverter.INSTANCE.reqToDo(request);
        gbMenuMapper.update(gbMenuDo);
        return Result.ok();
    }
}
